<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib  uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="Cache-Control" content="no-siteapp" />
        <link href="../assets/css/bootstrap.min.css" rel="stylesheet" />
        <link rel="stylesheet" href="../css/style.css"/>       
        <link href="../assets/css/codemirror.css" rel="stylesheet">
        <link rel="stylesheet" href="../assets/css/ace.min.css" />
        <link rel="stylesheet" href="../font/css/font-awesome.min.css" />
        <!--[if lte IE 8]>
		  <link rel="stylesheet" href="assets/css/ace-ie.min.css" />
		<![endif]-->
		<script src="../js/jquery-1.9.1.min.js"></script>
        <script src="../assets/js/bootstrap.min.js"></script>
		<script src="../assets/js/typeahead-bs2.min.js"></script>           	
		<script src="../assets/js/jquery.dataTables.min.js"></script>
		<script src="../assets/js/jquery.dataTables.bootstrap.js"></script>
        <script src="../assets/layer/layer.js" type="text/javascript" ></script>          
        <script src="../assets/laydate/laydate.js" type="text/javascript"></script>
        <script src="../js/dragDivResize.js" type="text/javascript"></script>
        <script src="../laydate/laydate.js"></script>
</head>
  
  <body>
    
<br><br><br><br><br>
<form action="../room/add.do" method="post">
<table border="1" align="center">

<tr>
<td width="500"><div class="form-group"><label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 所属项目 </label>
       &nbsp;&nbsp;&nbsp;&nbsp;
       <select id="project" name="projectid" onchange="tochange()">
              <option value="">---请选择---</option>
          <c:forEach var="project" items="${list}">
              <option value="${project.id }">${project.name}</option>
          </c:forEach>
       </select>
       
	</div>
</td>
</tr>
<tr>
<td width="500"><div class="form-group"><label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 所属楼栋 </label>
       &nbsp;&nbsp;&nbsp;&nbsp;
       <select name="complexid" id="complex" onchange="tochange2()">
       <option value="">---请选择---</option>
       </select>
       
	</div>
</td>
</tr>
<tr>
<td width="500"><div class="form-group"><label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 所属单元 </label>
       &nbsp;&nbsp;&nbsp;&nbsp;
       <select name="unitid" id="unit">
       <option value="">---请选择---</option>
       </select>
       
	</div>
</td>
</tr>

<tr>
<td><div class="form-group"><label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 房间名称 <font color="red">*</font></label>

       <div class="col-sm-9"><input type="text"    name="roomnumber" class="col-xs-10 col-sm-5" ></div>
	</div>
</td>
</tr>
<tr>
<td><div class="form-group"><label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 所属楼层 <font color="red">*</font></label>
       <div class="col-sm-9"><input type="text"   name="storey" class="col-xs-10 col-sm-5"></div>
	</div>
</td>
</tr>                  
<tr>
<td><div class="form-group"><label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 面积总和 <font color="red">*</font></label>
       <div class="col-sm-9"><input type="text"   name="area" class="col-xs-10 col-sm-5"></div>
	</div>
</td>
</tr>                  
<tr>
<td><div class="form-group"><label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 房间单价 <font color="red">*</font></label>
       <div class="col-sm-9"><input type="text"   name="roomprice" class="col-xs-10 col-sm-5"></div>
	</div>
</td>
</tr>   
<tr>
<td width="500"><div class="form-group"><label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 房间户型 </label>
       &nbsp;&nbsp;&nbsp;&nbsp;
       <select name="typeid">
                         <option value="三室一厅">三室一厅</option>
                         <option value="三室两厅">三室两厅</option>
                         <option value="四室一厅">四室一厅</option>
       </select>
	</div>
</td>
</tr>               
<tr>
<td width="500"><div class="form-group"><label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 房间用途 </label>
       &nbsp;&nbsp;&nbsp;&nbsp;
       <select name="purposeid">
                         <option value="住房">住房</option>
                         <option value="门市">门市</option>
       </select>
	</div>
</td>
</tr>               

                  
<tr>       
       <td><button  class="btn btn-primary radius" type="submit"><i class="fa fa-save "></i>保存并提交</button></td>
       
</tr>       
</table>
</form>
<script >
   function  tochange(){
     var id=$("#project").val();
    $.ajax({
    url:"../toAjax.do",
    type:"post",
    data:{"id":id},
    dataType:"json",
    success:function(data){
    var complexList = data.complexList;
    
   $("#complex").empty();
   
   $opo=$("<option value=''>---请选择---</option>");
   $("#complex").append($opo);
   
   
    for(var i =0;i<complexList.length;i++){
    
     $op = $("<option value='"+complexList[i].id+"'>#"+complexList[i].complexnumber+"</option>");
     
     $("#complex").append($op);
          }
        
                         },
  	error:function(){
  	alert("error");
     }
    
    });
    
    
    
   }
   
</script>
<script >
   function  tochange2(){
     var id=$("#complex").val();
    $.ajax({
    url:"../toAjax2.do",
    type:"post",
    data:{"id":id},
    dataType:"json",
    success:function(data){
    var unitList = data.unitList;
    
   $("#unit").empty();
   
   $opo=$("<option value=''>---请选择---</option>");
   $("#unit").append($opo);
    for(var i =0;i<unitList.length;i++){
    
     $op = $("<option value='"+unitList[i].id+"'>#"+unitList[i].unitenumber+"</option>");
     
     $("#unit").append($op);
          }
        
                         },
  	error:function(){
  	alert("error");
     }
    
    });
    
    
    
   }
   
</script>



  </body>
</html>
